package main

import (
	"github.com/micro/go-micro"
	"github.com/micro/go-micro/util/log"
	"ihome/getSession/handler"
	"ihome/getSession/subscriber"
	"ihome/utils"

	getSession "ihome/proto/getSession"
)

func main() {
	// New Service
	service := utils.NewGrpcService("go.micro.srv.getSession")

	// Register Handler
	getSession.RegisterGetSessionHandler(service.Server(), new(handler.GetSession))

	// Register Struct as Subscriber
	micro.RegisterSubscriber("go.micro.srv.getSession", service.Server(), new(subscriber.GetSession))

	// Register Function as Subscriber
	micro.RegisterSubscriber("go.micro.srv.getSession", service.Server(), subscriber.Handler)

	// Run service
	if err := service.Run(); err != nil {
		log.Fatal(err)
	}
}
